package com.xjh.him.controller;

import com.xjh.him.annotation.LoginVerify;
import com.xjh.him.service.FriendGroupServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.xjh.tool.dto.ResultDTO;
import org.xjh.tool.vo.AjaxResultVO;

@RestController
@RequestMapping("/friend/group")
public class FriendGroupController {

    @Autowired
    private FriendGroupServiceImpl friendGroupService;


    @LoginVerify
    @RequestMapping("/queryOrAdd")
    public AjaxResultVO queryOrAddGroup(Long firstId, Long secondId) {
        ResultDTO<Long> resultDTO = friendGroupService.queryOrAddGroup(firstId, secondId);
        if (resultDTO.isSuccess()) {
            return AjaxResultVO.getSuccessResult(resultDTO.getResult());
        }
        return AjaxResultVO.getFailureResult(resultDTO.getErrMsg());
    }
}
